package com.minsf.rpc.registry;

import com.minsf.rpc.model.ServiceMetaInfo;
import lombok.Data;

import java.util.List;

/**
 * @Description 注册中心服务本地缓存
 * @Author minify
 * @Date 2024/3/28 22:11
 * @Project sf-rpc
 */
@Data
public class RegistryServiceCache {

    /**
     * 服务缓存
     */
    List<ServiceMetaInfo> serviceCache;

    /**
     * 写缓存
     * @param newServiceCche
     */
    void writeCache(List<ServiceMetaInfo> newServiceCache) {
        this.serviceCache = newServiceCache;
    }

    /**
     * 读缓存
     * @return
     */
    List<ServiceMetaInfo> readCache() {
        return this.serviceCache;
    }

    /**
     * 清空缓存
     */
    void clearCache() {
        this.serviceCache = null;
    }

}
